@extends('layouts.admin')
@section('css')
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_page.css') }}" rel="stylesheet" />
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_table.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-datepicker/css/datepicker.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-daterangepicker/daterangepicker-bs3.css') }}" rel="stylesheet">
@endsection
@section('content')
<section id="main-content">
  <section class="wrapper">
      <!-- page start-->
      <div class="row">
          <div class="col-lg-12">
              <section class="panel">
                  <header class="panel-heading">
                      订单列表
                  </header>
                  <div class="panel-body right"  align="right">
                              
                             <form class="form-inline" action="{{ route('admin.shop.order') }}" role="form" method="get">
                                  {{ csrf_field() }}
                                  <div class="form-group">
                                      
                                      <label class="sr-only" for="exampleInputEmail2">选择类型</label>
                                          <select class="form-control" name="option_id">
                                              <option>订单类型</option>
                                              @foreach($options as $option)
                                              <option value="{{ $option->id }}" {{ $option->id==$data['option_id'] ? 'selected':'' }}>{{ $option->name }}</option>
                                              @endforeach
                                              <!-- <option>订单类型</option>
                                              <option>恒指期权</option>
                                              <option>伦敦金期权</option>
                                              <option>美元期权</option>
                                              <option>德指期权</option> -->
                                          </select>
                                      
                                  </div>

                                  <div class="form-group">
                                      <label class="sr-only" for="exampleInputEmail2">用户名</label>
                                      <input type="text" class="form-control tooltips" id="name" data-toggle="tooltip" name="name" value="{{ $data['name'] }}" placeholder="输入用户名">
                                  </div>
                                  <div class="form-group">
                                      <label class="sr-only" for="exampleInputPassword2">电话</label>
                                      <input type="text" class="form-control" id="mobile" name="mobile" value="{{ $data['mobile'] }}" placeholder="输入手机">
                                  </div>

                                  <div class="form-group "  >
                                      <!-- <label class="control-label col-md-3 sr-only">下单时间</label> -->
                                      <!-- <div class="col-md-4" > -->
                                          <!-- <div class="input-group input-large" data-date="13/07/2013" data-date-format="mm/dd/yyyy"> -->
                                              <input type="text" class="form-control dpd1 default-date-picker" name="from" value="{{ $data['from'] }}" placeholder="开始日期">
                                              <!-- <span class="">To</span> -->
                                              <!-- <input type="text" class="form-control dpd2" name="to"> -->
                                          <!-- </div> -->
                                          <!-- <span class="help-block">Select date range</span> -->
                                      <!-- </div> -->
                                  </div>
                                  -
                                  <div class="form-group "  >
                                      <!-- <label class="control-label col-md-3 sr-only">下单时间</label> -->
                                      <!-- <div class="col-md-4" > -->
                                          <!-- <div class="input-group input-large" data-date="13/07/2013" data-date-format="mm/dd/yyyy"> -->
                                              <!-- <input type="text" class="form-control dpd1" name="from"> -->
                                              <!-- <span class="input-group-addon">To</span> -->
                                              <input type="text" class="form-control dpd2 default-date-picker" name="to" value="{{ $data['to'] }}" placeholder="截止日期">
                                          <!-- </div> -->
                                          <!-- <span class="help-block">Select date range</span> -->
                                      <!-- </div> -->
                                  </div>

                                  <button type="submit" class="btn btn-info">搜索</button>
                              </form>

                          </div>
                  <table class="table table-striped table-advance table-hover">
                      <thead>
                      <tr>
                          <th> ID</th>
                          <!-- <th> 订单号</th> -->
                          <th> 用户</th>
                          <th><i class="icon-bullhorn"></i> 类型</th>
                          <!-- <th>订单金额</th> -->
                          <!-- <th>支付金额</th> -->
                          <th>执行价</th>
                          <th>结算价</th>
                          <th>止盈价</th>
                          <th>止损价</th>
                         <!--  <th>止盈金额</th>
                          <th>止损金额</th> -->
                          <th>保证金</th>
                          <th>综合费用</th>
                          <!-- <th>收益率</th> -->
                          <th>方向</th>
                          <!-- <th>时长</th> -->
                          <th><i class="icon-bookmark"></i> 盈亏</th>
                          <th><i class=" icon-edit"></i> 状态</th>
                          <th>结束时间</th>
                          <th>创建时间</th>
                          <th>更新时间</th>
                          <!-- <th></th> -->
                      </tr>
                      </thead>
                      <tbody>
                      @foreach($orders as $order)
                      <tr>
                          <th> {{ $order->id }}</th>
                          <!-- <th> {{ $order->orderno }}</th> -->
                          <th> {{ $order->user->name }}</th>
                          <th> {{ $order->option->name }}</th>
                          <!-- <th >{{ $order->amount }}</th> -->
                          <!-- <th >￥{{ $order->pays }}</th> -->
                          <th>{{ $order->buy_point }}</th>
                          <th>{{ $order->close_point }}</th>
                          <th>{{ $order->surplus_point }}</th>
                          <th>{{ $order->stop_loss_point }}</th>
                         <!--  <th>{{ $order->option->currency_unit }}{{ $order->surplus_value }}(￥{{ $order->option->exchange_rate*$order->surplus_value }})</th>
                          <th>{{ $order->option->currency_unit }}{{ $order->stop_loss_value }}(￥{{ $order->option->exchange_rate*$order->stop_loss_value }})</th> -->
                          <th>{{ $order->option->currency_unit }}{{ $order->stop_loss_margin }}(￥{{ $order->option->exchange_rate*$order->stop_loss_margin }})</th>
                          <th>{{ $order->option->currency_unit }}{{ $order->transaction_cost }}(￥{{ $order->option->exchange_rate*$order->transaction_cost }})</th>
                          <!-- <th>{{ $order->rate }}</th> -->
                          <th>{!! $order->directioninfo() !!}</th>
                          <!-- <th>{{ $order->times }}s</th> -->
                          <th>￥{{ $order->profit }}</th>

                          <th><span class="label {{ $order->statuslabel() }} label-mini"> {!! $order->status() !!}</span></th>
                          <th>{{ date('Y-m-d H:i:s',$order->close_time) }}</th>
                          <th>{{ $order->created_at }}</th>
                          <th>{{ $order->updated_at }}</th>
                          <!-- <th>
                           
                              <button class="btn btn-warning btn-xs"><i class="icon-pencil"></i></button>
                              
                          </th> -->

                          
                      </tr>
                      @endforeach

                      </tbody>
                  </table>
                  {!! $orders->appends($data)->links() !!}
              </section>
          </div>
      </div>
      <!-- page end-->
  </section>
</section>
@endsection
@section('javascript')
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/advanced-datatable/media/js/jquery.dataTables.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/assets/bootstrap-datepicker/js/bootstrap-datepicker.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/assets/bootstrap-daterangepicker/daterangepicker.js') }}"></script>
 <script src="{{ asset('admin/js/advanced-form-components.js') }}"></script>
 <script type="text/javascript" charset="utf-8">
      
        $(".user-delete").click(function () {
            Rbac.ajax.delete({
                confirmTitle: '确定删除该期权吗?',
                href: $(this).data('href'),
                successTitle: '删除成功'
            });
        });

        $(".deleteall").click(function () {
            Rbac.ajax.deleteAll({
                confirmTitle: '确定删除选中的期权?',
                href: $(this).data('href'),
                successTitle: '删除成功'
            });
        });
    
      
  </script>  
@endsection

